package com.gwcm.controller;

import com.gwcm.model.dto.memberCard.MemberCardAddRequest;
import com.gwcm.model.dto.userMemberCard.UserMemberCardAddRequest;
import com.gwcm.model.entity.MemberCard;
import com.gwcm.model.entity.UserMemberCard;
import com.gwcm.service.MemberCardService;
import com.gwcm.service.UserMemberCardService;
import com.yhz.commonutil.common.BaseResponse;
import com.yhz.commonutil.common.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userMemberCard")
@Api(tags = "用户会员卡接口")
public class UserMemberCardController {
    @Autowired
    public UserMemberCardService userMemberCardService;

    @ApiOperation("新增用户会员卡关联")
    @PostMapping("/save")
    public BaseResponse addUserMemberCard(@RequestBody UserMemberCardAddRequest userMemberCardAddRequest) {
        UserMemberCard userMemberCard = new UserMemberCard();
        BeanUtils.copyProperties(userMemberCardAddRequest, userMemberCard);

        userMemberCardService.saveUserMemberCard(userMemberCard);

        return ResultUtils.success();
    }


}
